import redis,Config

class DBRedis():
    def __init__(self):
        self.redis = redis.Redis(host=Config.SERVER,port=Config.REDIS_PORT,db=1,
						decode_responses=True)
    def SetDB(self,key=None,field=None,value=None):
        self.redis.hset(key, field,value)

    def QueryDB(self,key=None,name=None):
        return self.redis.hget(key,name)

    def CloseDB(self):
        self.redis.close()

red=DBRedis()
# red.SetDB(key='student',field='id',value='no1')
# print(red.QueryDB(key='student',name='id'))
